import React, {Component} from 'react';
import Tabbar from './components/tabbar/Tabbar';
import { HashRouter as Router, Route,  Redirect,Switch } from "react-router-dom";
import Home from './components/home/Home'
import Category from "./components/category/Category";
import Cart from "./components/cart/Cart";
import My from "./components/my/My";
import Search from "./components/search/Search";
import GoodDetail from "./components/goodDetail/GoodDetail";
import GoodList from "./components/goodList/GoodList";
import './App.css';

class App extends Component {
  render() {
    return (
        <div>
          <Router>
            <Switch>
              <Route exact path='/home' render={(props)=><Tabbar  {...props}><Home></Home></Tabbar>}></Route>
              <Route exact path='/search' render={(props)=><Search {...props}></Search>}></Route>
              <Route exact path="/goodDetail/:goods_id" render={(props)=><GoodDetail {...props}></GoodDetail>}></Route>
              <Route exact path="/goodList" render={(props)=><GoodList {...props}></GoodList>}></Route>
              <Route exact path='/category' render={(props)=><Tabbar  {...props}><Category></Category></Tabbar>}></Route>
              <Route exact path='/cart' render={(props)=><Tabbar  {...props}><Cart></Cart></Tabbar>}></Route>
              <Route exact path='/my' render={(props)=><Tabbar  {...props}><My></My></Tabbar>}></Route>
              <Redirect to='/home'></Redirect>
            </Switch>
          </Router>
        </div>
    );
  }
}

export default App;
